﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entity;
using BAL;
using Common;
using System.Text;
namespace Web
{
    public partial class PostComment : System.Web.UI.Page
    {
        private int examid = 0, page = 1;
        protected ExamRoomInfo examroomInfo = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!UserValidate.CheckLogin(this.Request, "ExamroomEdit"))
            {
                Response.Write("<script type=\"text/javascript\">top.location.href='login.aspx';</script>");
                Response.Redirect("login.aspx");
                Response.End();
            }
            if (!PageValidate.QueryStringIsEmpty("examid"))
            {
                examid = Convert.ToInt32(PageValidate.QueryString("examid"));
            }
            if (!PageValidate.QueryStringIsEmpty("page"))
            {
                page = Convert.ToInt32(PageValidate.QueryString("page"));
            }
            if (ExamRoom.CheckObjectById(examid))
                examroomInfo = ExamRoom.GetSingleInfo(examid);
            if (!IsPostBack)
            {
                if (examroomInfo != null)
                {
                    txtCommennt.Text = examroomInfo.Comment;
                }
                else
                {
                    Utility.ShowJsAlert("参数错误", this);
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (examroomInfo != null)
            {
                //examroomInfo.Comment = PageValidate.HtmlEncode(txtCommennt.Text.Trim());
                examroomInfo.Comment = txtCommennt.Text.Trim();
                ExamRoom.Save(examroomInfo);
                Utility.ReloadTopPage(this);
            }
            else
            {
                Utility.ShowJsAlert("参数错误", this);
            }
        }
    }
}
